package com.imooc.service.ServiceImple;

import com.imooc.dataobject.ProductCategory;
import com.imooc.repository.ProductCategoryRepository;
import com.imooc.service.ProductCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @param
 * @author chenmc
 * @date $date$ $time$
 * @return $returns$
 */
@Service
public class ProductCategoryServiceImple implements ProductCategoryService{
    @Autowired
    private ProductCategoryRepository repository;

    @Override
    public ProductCategory findOne(Integer id){
        return repository.findOne(id);
    }

    @Override
    public List<ProductCategory> findAll()  {
        return repository.findAll();
    }

    @Override
    public List<ProductCategory> findByCateGotyIds(List<Integer> Ids)  {
        return repository.findAll(Ids);
    }

    @Override
    public void saveProductCategory(ProductCategory productCategory)  {
    repository.save(productCategory);
    }

    @Override
    public List<ProductCategory> getProductCategoryInCategory(List<Integer> list) {
        return repository.findByCategoryTypeIn(list);
    }
}
